package com.qdd.freight.handler.impl;

import com.qdd.freight.anno.Mode;
import com.qdd.freight.entity.Datas;
import com.qdd.freight.handler.AbstractLogisticsCommonHandler;
import com.qdd.freight.pojo.GoodsShip;
import org.springframework.stereotype.Component;

/**
 * 京东快运-送货上门
 *
 * @ClassName NormalLogisticsHandler
 * @Description TODO
 * @Author yanpeihao
 * @Date 2019/12/6 22:47
 * @Version 2.2
 **/
@Component
@Mode("9")
public class JDLogToHomeHandler extends AbstractLogisticsCommonHandler {

    /**
     * 关键属性值，避免使用时再查询数据库中的字段
     */
//    //运输类型,1:物流运输,2:整车运输
//    private static final Integer CARRIER_TYPE = 1;
//    //承运商类别，1:普通物流,2:京东快运,3:德邦物流
//    private static final Integer TRANSPORT = 2;
//    //配送类型,1:物流自提，不包邮,2:送货上门，包邮
//    private static final Integer DELIVERY_TYPE = 2;
//    //快运方式名称：默认的应该需对应页面的名称
//    private static final String YFMODE_NAME = "京东物流";
//    //对应数据库的字段名
//    private static final String TABLE_FIELD_NAME = "jdwl_id";
    //对应常量的字段名
    private static final String CONSTANT_FIELD_NAME = "jdwlId";

    /**
     * 从具体实现类中获取字段，该字段的值等于该实现类在goodsShip中的一个字段
     *
     * @return
     */
    @Override
    protected String getShipFieldNameFromInstance() {
        return CONSTANT_FIELD_NAME;
    }

    @Override
    public Datas realHandle(GoodsShip goodsShip, Integer shipId, Integer modeId, Integer goodsId, Integer entId,
                            Integer quantity, Integer company, String consignee, Double boxVolume, Double singleVolume,
                            Double boxWeight, Double singleWeight, Integer QTYRate) throws Exception {
        //直接调用父类的通用方法即可
        Datas datas = commonFreightCount(shipId, modeId, goodsId, entId, quantity, company, consignee, boxVolume, singleVolume,
                boxWeight, singleWeight, QTYRate);
        return datas;
    }
}
